package test;

import org.junit.Test;

public class Coins {
    @Test
    public void solution() {
        int[] ints = {1,1,1,2,2,5};
        Integer count = new Integer(0);
        back(ints, 11, ints.length - 1, count);
    }
    public void back(int[] nums,int n,int p,Integer count){
        if(n < 0 || p < 0){
            return;
        }
        if(n == 0){
            System.out.println(count);
            return;
        }
        for (;p > 0;) {
            int c = count + 1;
            int m = n - nums[p--];
            back(nums,m,p,c);
        }
    }
}
